home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / OPTIMIZE / SPLSHDMO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-16  |  4.5 KB  |  153 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSplashDemo 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Using a Splash Screen"
  5.    ClientHeight    =   1710
  6.    ClientLeft      =   1515
  7.    ClientTop       =   1470
  8.    ClientWidth     =   5565
  9.    ClipControls    =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    PaletteMode     =   1  'UseZOrder
  14.    ScaleHeight     =   114
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   371
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.CommandButton cmdAppStartup 
  19.       Caption         =   "With&out  Splash"
  20.       Height          =   500
  21.       Index           =   1
  22.       Left            =   3015
  23.       TabIndex        =   1
  24.       Top             =   1080
  25.       Width           =   1395
  26.    End
  27.    Begin VB.CommandButton cmdAppStartup 
  28.       Caption         =   "&With  Splash"
  29.       Height          =   500
  30.       Index           =   0
  31.       Left            =   915
  32.       TabIndex        =   0
  33.       Top             =   1080
  34.       Width           =   1215
  35.    End
  36.    Begin VB.Label Label1 
  37.       BorderStyle     =   1  'Fixed Single
  38.       Caption         =   "Using a splash screen provides the user with feedback while your application is loading."
  39.       BeginProperty Font 
  40.          Name            =   "MS Sans Serif"
  41.          Size            =   12
  42.          Charset         =   0
  43.          Weight          =   700
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       ForeColor       =   &H00800000&
  49.       Height          =   720
  50.       Left            =   30
  51.       TabIndex        =   2
  52.       Top             =   45
  53.       Width           =   5490
  54.    End
  55. Attribute VB_Name = "frmSplashDemo"
  56. Attribute VB_GlobalNameSpace = False
  57. Attribute VB_Creatable = False
  58. Attribute VB_TemplateDerived = False
  59. Attribute VB_PredeclaredId = True
  60. Attribute VB_Exposed = False
  61. Option Explicit
  62. Private Sub cmdAppStartup_Click(Index As Integer)
  63.   Dim dStartTime As Double
  64.   dStartTime = Timer
  65.     Select Case Index
  66.       Case 0  'With Splash
  67.         ShowSplash
  68.       Case 1  'No Splash
  69.         NoSplash
  70.     End Select
  71.     MsgBox "Startup Time = " & Format$(Timer - dStartTime, "##.##") & " secs.", _
  72.                                             vbInformation, _
  73.                                             "App Startup Time"
  74.   End Sub
  75. Private Sub NoSplash()
  76.             
  77.   ' Now load a bunch of forms.
  78.   Dim foo1 As New frmImages
  79.   foo1.Caption = "Foo1"
  80.   foo1.Left = 0
  81.   foo1.Top = 0
  82.           
  83.   Dim foo2 As New frmImages
  84.   foo2.Caption = "Foo2"
  85.   foo2.Left = 200
  86.   foo2.Top = 100
  87.           
  88.   Dim foo3 As New frmImages
  89.   foo3.Caption = "Foo3"
  90.   foo3.Left = 300
  91.   foo3.Top = 150
  92.           
  93.   Dim foo4 As New frmImages
  94.   foo4.Caption = "Foo4"
  95.   foo4.Left = 400
  96.   foo4.Top = 200
  97. End Sub
  98. Private Sub ShowSplash()
  99.   Dim success%
  100.   Dim iStatusBarWidth As Integer
  101.   On Error GoTo SplashLoadErr
  102.   iStatusBarWidth = 4575
  103.             
  104.   Screen.MousePointer = vbHourglass
  105.   Load Splash
  106.   Splash.Show
  107.   DoEvents
  108.   ' Set the splash screen to stay on top.
  109.   success% = SetWindowPos(Splash.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  110.   ' Now load a bunch of forms.
  111.   Dim foo1 As New frmImages
  112.   'Splash.Refresh
  113.   foo1.Caption = "Foo1"
  114.   foo1.Move 0, 0
  115.   DoEvents
  116.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.25
  117.           
  118.   Dim foo2 As New frmImages
  119.   'Splash.Refresh
  120.   foo2.Caption = "Foo2"
  121.   foo2.Move 0, 0
  122.   DoEvents
  123.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.5
  124.   Dim foo3 As New frmImages
  125.   'Splash.Refresh
  126.   foo3.Caption = "Foo3"
  127.   foo3.Move 0, 0
  128.   DoEvents
  129.   Splash.rctStatusBar.Width = iStatusBarWidth * 0.75
  130.           
  131.   Dim foo4 As New frmImages
  132.   'Splash.Refresh
  133.   foo4.Caption = "Foo4"
  134.   foo4.Move 0, 0
  135.   DoEvents
  136.   Splash.rctStatusBar.Width = iStatusBarWidth
  137.   ' Turn off the top most window flag.
  138.   success% = SetWindowPos(Splash.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  139.   Unload Splash
  140.   Screen.MousePointer = vbDefault
  141.   Exit Sub
  142. SplashLoadErr:
  143.   success% = SetWindowPos(Splash.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  144.   Unload Splash
  145.   Screen.MousePointer = vbDefault
  146.   MsgBox Error$ & " - " & Str$(Err), vbExclamation, "Application Load Error"
  147.   Exit Sub
  148. End Sub
  149. Private Sub Form_Load()
  150.   Me.Left = frmExplore.Width + 400
  151.   Me.Top = (Screen.Height - Me.Height) * 0.9
  152. End Sub
  153.